"""
Generates a list of prime numbers between 2**8 and 2**16. Writes it out to a YAML file.
"""

import pickle

primes_list = []
numbers_list = [i for i in xrange(2,2**16)]

print "Generating primes..."
while len(numbers_list) != 0:
    print ".",
    curr_prime = numbers_list[0]
    primes_list.append(curr_prime)
    numbers_list.remove(curr_prime)
    for i in numbers_list:
        if i % curr_prime == 0:
            numbers_list.remove(i)

pickle.dump(primes_list, open("primes.pkl", "w"))
    
